Documentation

Color Maze

Thank you so much for purchasing our item from codecanyon.


  • Created: 14 Sep, 2024
  • Update: -

If you have any questions that are beyond the scope of this help file, Please feel free to email via Item Support Page.


Overview

Color Maze is a HTML5 game where you have to move the paintball and paint all of the maze, fill the entire maze to move on to the next level.

The ZIP package contains the game with 1280×768 and 768×1024 resolution that scales proportionally to fit current screen device.



Installation

Follow the steps below to setup your game:

  1. To install the game just upload folder /game to your hosting web server using FTP or localhost in order to use it on your website. The game won't run locally with some browser like Chrome due to some security mode.
  2. Below is the folder structure and needs to be uploaded to your website or localhost root directory:
    • game/assets - Images & audio files
    • game/css - Stylesheet files
    • game/js - Javacript files
    • game/edit.html - Built-in Editor page
    • game/editTools.html - Built-in Editor Tool
    • game/icon.ico - Website icon
    • game/share.jpg - Social share image
    • game/share.php - Social share file
    • game/index.html - Homepage
  3. You will need a website that runs PHP to make facebook share button work, and make sure to change Facebook Open Graph meta and Twitter meta in index.html, just replace [GAME_URL] to your game URL.
  4.                           
    <!-- for Facebook -->
    <meta property="og:image" content="[GAME_URL]/share.jpg" />
    <meta property="og:url" content="[GAME_URL]" />
    
    <!-- for Twitter -->
    <meta name="twitter:image" content="[GAME_URL]/share.jpg" />
                              
                            

Settings

Follow the steps below to customize your game:

You can easily customize game text and settings in game.js file

                        

//theme settings
var themeSettings = [
	{
		floor:'assets/item_floo_off_1.png',
		colors:[
			{fill:"#B10000", image:'assets/balls/balls_1_1.png', floor:'assets/item_floo_on_1.png'},
			{fill:"#13A800", image:'assets/balls/balls_1_2.png', floor:'assets/item_floo_on_1.png'},
			{fill:"#8516B7", image:'assets/balls/balls_1_3.png', floor:'assets/item_floo_on_1.png'},
			{fill:"#1C86C7", image:'assets/balls/balls_1_4.png', floor:'assets/item_floo_on_1.png'},
			{fill:"#CC7700", image:'assets/balls/balls_1_5.png', floor:'assets/item_floo_on_1.png'},
			{fill:"#CCC111", image:'assets/balls/balls_1_6.png', floor:'assets/item_floo_on_1.png'},
			{fill:"#BC0093", image:'assets/balls/balls_1_7.png', floor:'assets/item_floo_on_1.png'},
			{fill:"#00ABAF", image:'assets/balls/balls_1_8.png', floor:'assets/item_floo_on_1.png'},
		]
	}
]

//game settings
var gameSettings = {
	blockSize:50,
	pathColor:'#A3A3A3',
	blockColor:'#fff',
	sideColor:'#E2E2E2',
	sideHeight:10,
	trailColor:'#fff',
	trailAlpha:.5,
	trailSpeed:.5,
	moveSpeed:.2,
	keyboard:{ //keyboard code
		left:[37,65],
		right:[39,68],
		up:[38,87],
		down:[40,83],
	}
};

//game text display
var textDisplay = {
	selectLevel:'SELECT LEVEL',
	exitTitle:'EXIT GAME',
	exitMessage:'ARE YOU SURE\nYOU WANT TO\nQUIT GAME?',
	share:'SHARE YOUR SCORE:',
	resultTitle:'GAME OVER',
	resultComplete:'COMPLETE',
	resultDesc:'LEVEL [NUMBER]',
}

//Social share, [SCORE] will replace with game score
var shareEnable = true; //toggle share
var shareTitle = 'Highscore on Color Maze is Level [SCORE]';//social share score title
var shareMessage = 'Level [SCORE] is mine new highscore on Color Maze game! Try it now!'; //social share score message
                        
                      

The sound can be easily disabled to avoid compatibility issues in sound.js file:

                         
var enableDesktopSound = true; //sound for dekstop
var enableMobileSound = true; //sound for mobile and tablet
                      
                        

Levels

You can easily customize levels in levelSettings in level.js file, it store level settings and below is the explanation of each most important objects:

                        
var levelSettings = [
	{
		puzzle:[
			[0,0,0,],
			[0,1,0,],
			[0,1,0,],
			[0,1,0,],
			[0,1,0,],
			[0,1,0,],
			[0,0,0,],
		],
		start:{
			x:1,
			y:1
		}
	}
]
            
            
  • puzzle - array of puzzle (0 = block, 1 = path)
  • start - start position
    1. x - position x
    2. y - position y

Built-in Editor

This is the section where you can edit the levels with the tool by running edit.html. The page start with edit tools, click generate button to export the array when you complete editing, replace the new array in levelSettings in level.js file.

1. Basic Options
  1. First select the viewport mode, then select the puzzle you want to edit.
  2. Option to add, remove and sort puzzles.
  3. This section is to edit puzzle, and also output the new array objects.
    • Edit Puzzle - edit puzzle settings
    • Test Play - test play the puzzle
    • Generate Array - click to generate new Array, copy and replace into levelSettings in level.js for new update

2. Edit Puzzle

Click on the grid to switch between block or path.

  1. Enter the maze size
  2. Enter the ball start position
  3. Click update puzzle to update new maze and position, click done to go back main options.

HTML Structure

Structure used to design web pages including HTML structure, CSS Files, Javascript and more...

The page start with the loader wrapper that covering the whole screen in the body. It shows loader progress when calls the function initPreload()

                        
<!-- PERCENT LOADER START-->
<div id="mainLoader"><img src="assets/loader.png" /><br><span>0</span></div>
<!-- PERCENT LOADER END-->
                    
                    

This section is for browser not support page when calls the function checkBrowser(). It shows error message when detect the browser does not support canvas.

                        
<!-- BROWSER NOT SUPPORT START-->
<div id="notSupportHolder">
    <div class="notSupport">YOUR BROWSER ISN'T SUPPORTED.<br/>PLEASE UPDATE YOUR BROWSER IN ORDER TO RUN THE GAME</div>
</div>
<!-- BROWSER NOT SUPPORT END-->
                        
                      

Follow by one canvas tag in the body. The game start initiatie by calls the main function of the game initMain().

                        
<!-- CANVAS START-->
<div id="canvasHolder">
	<canvas id="gameCanvas" width="1280" height="768"></canvas>
</div>
<!-- CANVAS END-->
                    
                  

CSS Files

We're using two CSS files in this game. The first one is normalize.css a generic reset file. Many browser interpret the default behavior of html elements differently. By using a general reset CSS file, we can work round this. This file also contains some general styling, such as anchor tag colors, font-sizes, etc. Keep in mind, that these values might be overridden somewhere else in the file.

The second file main.css contains all of the specific stylings for the canvas and some hack to be fully compatible with all most popular mobile device.


JavaScript

This game using Javascript files below.

  1. jquery.min.js - is a cross-platform JavaScript library designed to simplify the client-side scripting of HTML.

  2. detectmobilebrowser.js - is a open source scripts to detect mobile browsers and phones.

  3. createjs.min.js - is a suite of modular libraries and tools which work together to create interactive content on open web technologies via HTML5.

  4. TweenMax.min.js - is an extremely fast, lightweight, and flexible animation tool that serves as the foundation of the GreenSock Animation Platform (GSAP).

  5. js.cookie.js - is a simple, lightweight JavaScript API for handling cookies.

  6. The game have the following js files

    • init.js - check if browser or device support
    • loader.js - loader to load all game images
    • main.js - initiate game setup and browser resize function
    • mobile.js - mobile orientation change
    • canvas.js - canvas setup and resize
    • sound.js - sound event
    • edit.js - built-in editor tool function
    • level.js - level settings
    • game.js - game play and logics
    • plugins.js - additonal useful plugins

Game Flow

  1. The index.html file start init.js for browser detection
  2. If browser is supported, init loader.js to start load asserts with loading progress
  3. For mobile the rotate instruction shows when device is in portrait view, detect by mobile.js
  4. When all asserts contained in /assets folder are loaded, the game start construct canvas.js from main.js thats shows game menu
  5. If user click start button in game menu, the game will start with game.js
  6. If user swipe the screen or press arrow keyboard, the paintball will move and fill the path direction
  7. If user click undo button, it will undo to previous stroke
  8. If user fill the maze, the level will complete
  9. If user click the main button in game result, it will go to level page

Game Functions

The most important functions used for page.

  • checkBrowser() This function is runs for browser detection
  • checkMobileEvent() This function runs for mobile event

The most important functions used for game.

  • initMain() This function build canvas
  • startGame() This function start gameplay
  • updateGame() This function manages the game loop
  • stopGame() This function stop gameplay
  • saveGame() This function save game score

Game Assets

You can edit the design files and easily reskin the game graphics.

The game contain /design folder which include following:

  • colormaze_1280x768.psd - with layer folders below
    • Option
    • Result
    • Gameplay
    • Landing

The folder /game/assets contains all the images of the game that can be replaced. Is better to have the same size of the old ones if you want to reskin the game graphic without coding.


Compatibility

This game is build for Desktop browsers that support HTML5 canvas. Any mobile/tablet should work in landscape and portrait view, but they are not officially supported.


Add-ons

The add-on is an additional feature added to the game and it requires the base game in order to work, below are the add-ons that are compatible with this game:

This game is compatible with Scoreboard for HTML5 Games, it is a add-ons page where user can submit score and view top 10 leaderboard. You can get it here.


Source & Credits

Fonts:

Images:

  • N/A

Sounds:


Support

If this documentation doesn't answer your questions, you can send us email via Item Support Page

Note: While we aim to provide the best support possible, please keep in mind that it only extends to verified buyers and only to issues related to our game like bugs and errors. Custom modifications or third party module implementations are not included. Please read and check item support policy here.

Here you can find plugin & other documentation that support this game.

  • Wordpress Site - By using Scoreboard for HTML5 Games plugin, you can embed HTML5 game into WordPress post or page. Get the Plugin
  • Ad Placeholder - Help simulate ads on HTML5 Games, you can integrate and display static and takeover ads through different Ads Serving Platform. Documentation
  • Instant Games – Facebook - Guide you through integrating Facebook Instant Games API in our HTML5 Games. Documentation

Don’t forget to Rate this game

Please Add your Review (Opinion) for Our game. It would be a great support for us.
Go to your Codecanyon Profile > Downloads Tab > & then You can Rate & Review for our game.
Thank You.

Changelog

See what's new added, changed, fixed, improved or updated in the latest versions.

Version 1.0

Initial Release